package com.rc.saas.mini.service.ugs;

import com.rc.saas.mini.mapper.ugs.TenantUgsLevelGrowingMapper;
import com.rc.saas.mini.model.ugs.TenantUgsLevelGrowing;
import com.rc.saas.mini.model.ugs.TenantUgsLevelGrowingExample;
import com.rc.saas.mini.vo.ugs.TenantUgsLevelGrowingVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TenantUgsLevelGrowingServiceImpl implements TenantUgsLevelGrowingService {

    @Autowired
    private TenantUgsLevelGrowingMapper tenantUgsLevelGrowingMapper;

    @Override
    public TenantUgsLevelGrowingMapper getMapper() {
        return tenantUgsLevelGrowingMapper;
    }

    @Override
    public TenantUgsLevelGrowing selectByGrowingType(String tenantCode, String growingType) {
        TenantUgsLevelGrowingExample example = new TenantUgsLevelGrowingExample();
        example.createCriteria().andTenantCodeEqualTo(tenantCode).andGrowingTypeEqualTo(growingType).andStatusEqualTo("0");
        List<TenantUgsLevelGrowing> tenantUgsLevelGrowings = tenantUgsLevelGrowingMapper.selectByExample(example);
        if (tenantUgsLevelGrowings != null && tenantUgsLevelGrowings.size() > 0) {
            return tenantUgsLevelGrowings.get(0);
        }
        return null;
    }

    @Override
    public List<TenantUgsLevelGrowingVo> listUgsLevelGrowingWithoutSignIn(String tenantCode) {
        return tenantUgsLevelGrowingMapper.listUgsLevelGrowingWithoutSignIn(tenantCode);
    }
}
